package com.uenpay.oem.data.bean;

import com.uenpay.im.IMApplication;
import com.uenpay.util.common.DateUtils;
import com.uenpay.util.common.HardWareUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * Author: liulou
 * Date: 2017/6/6.
 * desc:
 */

public class Request {
    private static final String TAG = "Request";

    private RequestHeader head;
    private Map<String, String> body;

    private Request() {
        head = new RequestHeader();
        body = new HashMap<>();
        head.reqVersion = "V1.1";
        head.requestKey = HardWareUtils.getDeviceInfo();
        head.token = IMApplication.getInstance().getUcrtoken();
        head.openId = IMApplication.getInstance().getUcrOpendId();
        head.custId = IMApplication.getCustId();
        head.trxDate = DateUtils.getLocalDataTime("yyyyMMddHHmmSS");
    }

    public Request(String transCode) {
        this();
        head.transCode = transCode;
    }

    public Request(String transCode, Map body) {
        this();
        head.transCode = transCode;
        this.body = body;
    }

    public RequestHeader getHeader() {
        return head;
    }

    public void setHeader(RequestHeader header) {
        this.head = header;
    }

    public Map<String, String> getBody() {
        return body;
    }

    public void setBody(Map<String, String> body) {
        this.body = body;
    }

    @Override
    public String toString() {
        return "Request{" +
                "header=" + head.toString() +
                ", body=" + body.toString() +
                '}';
    }
}
